using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sixeyed.CacheAdapter.Management;
using Microsoft.BizTalk.Adapter.Framework;
using Sixeyed.CacheAdapter.Management.Tests.Properties;
using System.Xml;

namespace Sixeyed.CacheAdapter.Management.Tests
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class AdapterManagementTest
    {
        public AdapterManagementTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private AdapterManagement _management;
        private AdapterManagement Management
        {
            get
            {
                if (_management == null)
                {
                    _management = new AdapterManagement();
                }
                return _management;
            }
        }

        [TestMethod]
        public void GetConfigSchema()
        {
            string schema = Management.GetConfigSchema(ConfigType.TransmitLocation);
            Assert.AreEqual<string>(Resources.TransmitLocationSchema, schema);
        }

        [TestMethod]
        public void ValidateConfiguration()
        {
            string configXml = Resources.CacheConfig;
            configXml = Management.ValidateConfiguration(ConfigType.TransmitLocation, configXml);
            TransmitLocation location = TransmitLocation.Deserialize(configXml);
            Assert.IsNotNull(location.Uri);
            Assert.AreEqual<string>("cache://NCacheExpressProvider/NCache%201", location.Uri);
        }
    }
}
